package fr.norsys.mapper.console.exception;

public class BaseAppException extends Exception {
	private static final long serialVersionUID = 6666343385795217145L;
	/**
     * the message of the BaseAppException.
     */
    private String exceptionMessage;

    /**
     * A public constructor for BaseAppException containing no arguments.
     *  
     */
    public BaseAppException() {
    	super();
    }

    /**
     * A public constructor for BaseAppException specifying exception message.
     * <p>
     * 
     * @param msg
     *            exception message.
     *  
     */
    public BaseAppException(String msg) {
    	super();
        this.exceptionMessage = msg;
    }

    /**
     * A public constructor of <code>BaseAppException</code> containing
     * message and root cause (as <code>Throwable</code>) of the exception.
     * 
     * @param msg
     *            exception message.
     * @param e
     *            Throwable object.
     *  
     */
    public BaseAppException(String msg, Throwable e) {
    	super();
        this.exceptionMessage = msg;
        this.initCause(e);
    }

    /**
     * sets the root cause of the exception. Used for setting Java built in
     * exception in <code>BaseAppException</code>.
     * 
     * @param e
     *            Throwable object.
     *  
     */
    public void setCause(Throwable e) {
        this.initCause(e);
    }

    /*
     * Gets the class name and exception message.
     * 
     * @see java.lang.Object#toString()
     */
    public String toString() {
        String s = getClass().getName();
        return s + ": " + exceptionMessage;
    }

    /*
     * Gets the message of the exception. equivalent to Exception.getMessage().
     * 
     * @see java.lang.Throwable#getMessage()
     */
    public String getMessage() {
        return exceptionMessage;
    }
    public String getExceptionMessage() {
        return exceptionMessage;
    }
    public void setExceptionMessage(String m){
    	this.exceptionMessage = m;
    }
}